package user

import (
	"5title_gin/internal/api/middleware"
	userApi "5title_gin/internal/api/v1/user"
	"5title_gin/internal/model"
	"5title_gin/internal/model/user"

	"github.com/gin-gonic/gin"
)

func UserRouter(privateAPI *gin.RouterGroup, publicAPI *gin.RouterGroup) {
	app := userApi.NewUserAPI()

	UserAPI := privateAPI.Group("/users")
	{
		UserAPI.GET("/info", app.GetUserInfo)
		UserAPI.PUT("/update", middleware.BindJsonMiddleware[user.UserModel], app.UpdateUserInfo)
		UserAPI.POST("/create", middleware.BindJsonMiddleware[user.UserModel], app.CreateUser)
		UserAPI.DELETE("/delete/:id", app.DeleteUser)
		UserAPI.GET("/list", middleware.BindQueryMiddleware[model.PageInfo], app.UserListView)
		UserAPI.GET("/:id", app.GetUserById)
	}

}
